﻿using IterationLife.Domains.Sports.Models;
using Util;
using Util.Maps;

namespace IterationLife.Football.MTSports.Dtos.Sports {
    /// <summary>
    /// 体育比赛数据传输对象扩展
    /// </summary>
    public static class SportEventDtoExtension {
        /// <summary>
        /// 转换为体育比赛实体
        /// </summary>
        /// <param name="dto">体育比赛数据传输对象</param>
        public static SportEvent ToEntity( this SportEventDto dto ) {
            if ( dto == null )
                return new SportEvent();
            return dto.MapTo( new SportEvent( dto.Id.ToGuid() ) );
        }
        
        /// <summary>
        /// 转换为体育比赛数据传输对象
        /// </summary>
        /// <param name="entity">体育比赛实体</param>
        public static SportEventDto ToDto(this SportEvent entity) {
            if( entity == null )
                return new SportEventDto();
            return entity.MapTo(new SportEventDto());
        }

    }
}
